Program support utilities

From Cppreference

Jump to: navigation, search

Contents

[edit] Program termination

The following functions manage program termination and resource cleanup.

Functions

Defined in header <cstdlib>
abort
causes abnormal program termination (without cleaning up)
(function)
exit
causes normal program termination with cleaning up
(function)
quick_exit (C++0x)
causes normal program termination without completely cleaning up
(function)
_Exit (C++0x)
causes normal program termination without cleaning up
(function)
atexit
registers a function to be called on exit() invocation
(function)
at_quick_exit (C++0x)
registers a function to be called on quick_exit invocation
(function)

Macro constants

EXIT_SUCCESS
indicates successful program execution
(macro constant)
EXIT_FAILURE
indicates unsuccessful program execution
(macro constant)

[edit] Communicating with the environment

system
calls the host environment's command processor
(function)
getenv
access to the list of environment variables
(function)

[edit] Signals

Several functions and macro constants for signal management are provided in <csignal> header.

Functions

signal
sets a signal handler for particular signal
(function)
raise
runs the signal handler for particular signal
(function)

Macro constants

SIG_DFL
default signal handling
(macro constant)
SIG_IGN
signal ignored
(macro constant)
SIG_ERR
error was encountered
(macro constant)
Signal types
SIGABRT
abnormal termination
(macro constant)
SIGFPE
floating point exception
(macro constant)
SIGILL
invalid instruction
(macro constant)
SIGINT
interactive attention request sent to the program
(macro constant)
SIGSEGV
invalid memory access
(macro constant)
SIGTERM
termination request sent to the program
(macro constant)

[edit] Non-local jumps

Types

jmp_buf
execution context type
(function)

Functions

setjmp
saves the context
(function)
longjmp
jumps to specified location
(function)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages